home *** CD-ROM | disk | FTP | other *** search
- Path: sn.no!not-for-mail
- From: christon@sn.no (Christopher Naas)
- Newsgroups: comp.sys.amiga.programmer
- Subject: sprintf in library
- Date: 19 Feb 1996 15:53:06 +0100
- Organization: SN Internett
- Message-ID: <1593.6623T953T661@sn.no>
- NNTP-Posting-Host: sinsen.sn.no
- X-Newsreader: THOR 2.21 (Amiga;SOUP)
-
- I'm having problems using sprintf() with floating point values in a shared
- library.
-
- The smakefile for the library is:
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- all: Memory.kbb
-
- Memory.o: Memory.c
- sc libcode nostackcheck smallcode smalldata strmerge opt Memory.c gst
- include:all.gst math ffp
-
- Memory.kbb: Memory.o
- sc link Memory.o startup=libinit noicons to Memory.kbb libfd
- KarmaBar:BarItems/kbBarItem.fd libversion 1 librevision 0
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-
- I open mathffp.library in my program and give MathBase to the shared library
-
- #define MathBase mystruct->MathBase
-
-
- .. this works fine for dos.library, intuition.library and so on.
-
-
- The problem is this. In my library, I use floating point numbers, and sprintf
- a calculation to a string, like this:
-
- sprintf (string, "%s %.2f%s\0", Prefix, c/1024/1024, Suffix);
-
- 'c' is a float. The library works fine when I comment out this string, but
- crashes if it's there (even if it's not run!).
-
- BTW: Just c = c/1024/1024; works fine. As long as I don't call sprintf, it
- works, so I guess it's the %.2f thing that's causing my problems.
-
- ...
-
-
- The main program is also compiled with math=ffp, and I manually Open and Close
- the mathffp.library (MathBase).
-
-
- So, my question is this; why doesn't it work? It works for all other
- libraries, so why not for mathffp.library?
-
-
- --
- Christopher Landmark Naas o EMail: christon@sn.no
- LoungeBar Development o WWW: http://www.sn.no/~christon/
- Former Reg. Amiga Developer o IRC: KarmaComa
-